import request from "@/utils/request";

export interface AdviceQuery extends PageQuery {
  page?: number;
  limit?: number;
  keywords?: string;
  type?: string;
}

export interface AdviceDetail {
  id: number;
  type: string;
  status: number;
  object_id: number;
  content?: string;
  reply?: string;
  contact_phone?: string;
  create_user?: any;
  create_time?: string;
}

export interface AdviceForm {
  id?: number;
  reply?: string;
  status?: number;
}

const baseUri = "/mv1/api/advice";

export function adviceList(query: AdviceQuery) {
  return request({
    url: baseUri + "/",
    method: "get",
    params: query,
  });
}

export function adviceDetail(id: number) {
  return request({
    url: baseUri + "/detail/" + id,
    method: "get",
    // params: {id},
  });
}

export function createAdvice(data: AdviceForm) {
  return request({
    url: baseUri + "/edit",
    method: "post",
    data: data,
  });
}

export function updateAdvice(id: number, data: AdviceForm) {
  return request({
    url: baseUri + "/edit/" + id,
    method: "put",
    data: data,
  });
}


/**
 * 清空打印机
 * @param id
 */
export function clearAdvice(id: number) {
  return request({
    url: baseUri + "/clear/" + id,
    method: "post",
  });
}

export function deleteAdvice(id: number) {
  return request({
    url: baseUri + "/" + id,
    method: "delete",
  });
}
